#include <stdio.h>
#include <stdbool.h>

bool isHappy(int n) {
    int sum = 0;
    int count = 0;
    while(sum!=1 && count<50)
    {
        while(n!=0)
        {
            sum = sum + (n%10)*(n%10);
            n = n/10;
        }
        if(sum==1) 
            return true;
        n = sum;
        sum = 0;
        count++;
    }
    return false;
}



int main()
{

    int n = 7;
    if(isHappy(n))
        printf("true\n");
    else
        printf("flase\n");
    return 0;
}